package com.yuxi.common.enums;

/**
*    @author sunke
*    @Date 2023-09-06 14:17:04
*    @description 业务类型
*/



import com.yuxi.pubInter.EnumVO;

import java.util.ArrayList;
import java.util.List;

public enum SysOperLogBusinessTypeEnum {

    OTHER(0, "其它") ,
    INSERT(1, "新增") ,
    UPDATE(2, "修改") ,
    DELETE(3, "删除") ,
    GRANT(4, "授权") ,
    EXPORT(5, "导出") ,
    IMPORT(6, "导入") ,
    FORCE(7, "强退") ,
    GENCODE(8, "生成代码") ,
    CLEAN(9, "清空") ,
    DETAIL(10, "详情") ,
    LIST(11, "列表") ,
    QUERY(12, "查询") ;



    public final static int OTHER_TYPE = 0;
    /**
     * 新增
     */
    public final static int INSERT_TYPE = 1;
    /**
     * 修改
     */

    public final static int UPDATE_TYPE = 2;
    /**
     * 删除
     */
    public final static int DELETE_TYPE = 3;
    /**
     * 授权
     */
    public final static int GRANT_TYPE = 4;
    /**
     * 导出
     */
    public final static int EXPORT_TYPE = 5;
    /**
     * 导入
     */
    public final static int IMPORT_TYPE = 6;
    /**
     * 强退
     */
    public final static int FORCE_TYPE = 7;
    /**
     * 生成代码
     */
    public final static int GENCODE_TYPE = 8;
    /**
     * 清空
     */
    public final static int CLEAN_TYPE = 9;
    /**
     * 详情
     */
    public final static int DETAIL_TYPE = 10;
    /**
     * 列表
     */
    public final static int LIST_TYPE = 11;
    /**
     * 查询
     */
    public final static int QUERY_TYPE = 12;

    private Integer type;
    private String desc;

    SysOperLogBusinessTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByType(Integer type) {
        if(type==null ){
            type=0;
        }
        for (SysOperLogBusinessTypeEnum var : SysOperLogBusinessTypeEnum.values()) {
            if (type==var.getType().intValue())
                return var.getDesc();
             }
        return SysOperLogBusinessTypeEnum.values()[0].getDesc();
    }

    public static List<EnumVO> getDescs() {
        List list = new ArrayList();

        for (SysOperLogBusinessTypeEnum var : SysOperLogBusinessTypeEnum.values()) {
            EnumVO enumVO = new EnumVO();
            enumVO.setId(var.getType()+"");
            enumVO.setName(var.getDesc());
            list.add(enumVO);
        }


        return list;
    }

}
